#include<glib.h>

void iterator(gpointer key, gpointer value, gpointer *user_data){
    g_printf("Key: %s Value: %s\n", (gchar *)key, (gchar *)value);
    gchar *cvalue = "HELLO WORLD";
    *user_data = (gpointer)cvalue;
}

int main(int argc,char * argv[]){
    GHashTable *hashtable = g_hash_table_new(g_str_hash,g_str_equal);
    g_hash_table_insert(hashtable, "Virginia", "Richmond");
    g_hash_table_insert(hashtable, "Texas", "Austin");
    g_hash_table_insert(hashtable, "Ohio", "Columbus");

    gpointer user_data = (gchar *)"HELLO";
    g_hash_table_foreach(hashtable,(GHFunc) iterator,&user_data);

    g_printf("(%s)There are %d keys in the hash\n", (gchar *)user_data, g_hash_table_size(hashtable));
    g_hash_table_destroy(hashtable);
    return (0);
}
